<template>
  <div>
    <div class="recommend-title">
      <img class="recommend-title-img" src="http://img1.qunarzz.com/piao/fusion/1711/16/bfbb9874e8f11402.png">
      热销推荐
    </div>
    <ul>
      <router-link tag="li" class="item border-bottom" v-for="(item,index) in recommendList" :key="index"
      :to="'/datail/' + item.id"
      >
          <div class="item-img-wrapper">
            <img class="item-img" :src="item.imgUrl" />
          </div>
          <div class="item-info">
            <div class="item-title">{{item.title}}</div>
            <div class="item-desc">{{item.desc}}</div>
            <button class="item-button">查看详情</button>
          </div>
        </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'HomeRecommend',
  props: {
    recommendList: Array
  },
  computed: {
    showRecommendList () {
      return this.recommendList.length
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/mixins.styl';
  .recommend-title
    padding-top: .2rem
    padding-bottom: .2rem
    line-height: .4rem
    height: .4rem
    background: #fff
    text-indent: .2rem
    .recommend-title-img
      width: .3rem
      height: .3rem
      display: inline-block
      vertical-align: top
      margin-left: .02rem
  .item
    display: flex
    height: 2rem
    overflow: hidden
    .item-img
      width: 2rem
      height: 2rem
      padding: .1rem
    .item-info
      flex: 1
      min-width: 0 // 避免出现不了省略号
      padding: .1rem
      .item-title
        line-height: .54rem
        font-size: .32rem
        ellipsis()
      .item-desc
        line-height: .4rem
        color: #ccc
        ellipsis()
      .item-button
        line-height: .4rem
        margin-top: .16rem
        background: #fff
        border-radius: .06px
        color: #00afc7
        font-family: Arial, "Microsoft Yahei", "Helvetica Neue", Helvetica, sans-serif
</style>
